﻿using CRM.Admin.Contracts.Contract.Customer;
using KingsSharp.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CRM.Admin.Contracts.Dto.Customer;
using CRM.Admin.Contracts.Model.Customer;
using KingsSharp.Common.Data;
using KingsSharp.Core.Data;
using KingsSharp.Common;
using CRM.Admin.Contracts.Model.Map;

namespace CRM.Admin.Services.Service.Customer
{
    public class AreaRequstService : ServiceBase, IAreaRequestService
    {
        private IRepository<AreaRequstInfo, Guid> areaRequstRepository;
        public AreaRequstService(IRepository<AreaRequstInfo, Guid> _areaRequstRepository)
            :base(_areaRequstRepository.UnitOfWork)
        {
            areaRequstRepository = _areaRequstRepository;
        }
        public IQueryable<AreaRequstInfo> AreaRequsts { get { return areaRequstRepository.Entities; } }
        public OperationResult Insert(params AreaRequstDto[] dtos)
        {
            dtos.CheckNotNull("dtos");
            foreach (var t in dtos)
            {
                t.Id = Guid.NewGuid();
                t.CreateTime = DateTime.Now;
            }
            var result = areaRequstRepository.Insert(dtos);
            return result;
        }
    }
}
